#pragma once

#include "..\Common\AutoHideImpl.h"
#include "..\Common\AutoSnapImpl.h"
//#include "..\MainDlg.h"


class CToolBoxFloatDlg 
	: public CBkDialogImpl<CToolBoxFloatDlg>
	,public CWHRoundRectFrameHelper<CToolBoxFloatDlg>
	,public CAutoSnapImpl<CToolBoxFloatDlg>, public CAutoHideImpl<CToolBoxFloatDlg, 2>
{
public:
	CToolBoxFloatDlg()
		: CBkDialogImpl<CToolBoxFloatDlg>(IDR_BK_FLOATWIN_DLG)
	{

	}

	~CToolBoxFloatDlg(void)
	{		
	}

protected:
	TRACKMOUSEEVENT		tmeTrack;
	BOOL				bMouseInWindow;
	bool bHide, bStartHide;
	bool bChangeStyle;
	bool bMakeTransparent;
	int		nOpacity;
	
protected:
	LRESULT		OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	BOOL		OnInitDialog(HWND wParam, LPARAM lParam);	
	LRESULT		OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	//void		OnBkBtnClose();
	//void		OnOK();	
	void OnMove(CPoint pt);
	void OnMouseMove(UINT ui, CPoint pt);
	void OnMouseLeave(void);
	void OnMouseHover(WPARAM wParam, CPoint pt);
	void OnTimer(UINT timerID);
	void KeepInScreen(CPoint pt);
	void WhenGoHide(void);
	
	void WhenGoShow(void);

	void OnLButtonDbClk(UINT ui, CPoint pt);
	void OnRButtonUp(UINT ui, CPoint pt);
	void OnLButtonDown(UINT ui, CPoint pt);
public:
	void _init();
	
	void SetAutoHide(BOOL bAHide)
	{
		this->bAutoHide = bAHide;
		PrepareAutoHide(bAutoHide);
	}
	void SetTransparent(BOOL bTra)
	{
		this->bMakeTransparent = bTra;
	}
	void SetOpacity(int nOp)
	{
		nOpacity = nOp;
	}
public:
	typedef CAutoHideImpl<CToolBoxFloatDlg, 2> AutoHideClass;

	BK_NOTIFY_MAP(IDC_RICHVIEW_WIN);


	BK_NOTIFY_MAP_END()

	BEGIN_MSG_MAP_EX(CToolBoxFloatDlg)	
		MSG_BK_NOTIFY(IDC_RICHVIEW_WIN)
		CHAIN_MSG_MAP(CBkDialogImpl<CToolBoxFloatDlg>)
		CHAIN_MSG_MAP(CWHRoundRectFrameHelper<CToolBoxFloatDlg>)
		MESSAGE_HANDLER(WM_CREATE,				OnCreate)
		MESSAGE_HANDLER(WM_DESTROY,				OnDestroy)	
		MSG_WM_INITDIALOG(OnInitDialog)	
		//MSG_WM_MOVE(OnMove)
		//MSG_WM_MOUSEMOVE(OnMouseMove)
		//MSG_WM_MOUSELEAVE(OnMouseLeave)
		//MSG_WM_MOUSEHOVER(OnMouseHover)
		//MSG_WM_LBUTTONDOWN(OnLButtonDown)
		MSG_WM_RBUTTONUP(OnRButtonUp)
		MSG_WM_LBUTTONDBLCLK(OnLButtonDbClk)
		MSG_WM_TIMER(OnTimer)
		CHAIN_MSG_MAP(CBkDialogImpl<CToolBoxFloatDlg>)
		CHAIN_MSG_MAP(CWHRoundRectFrameHelper<CToolBoxFloatDlg>)
		CHAIN_MSG_MAP(CAutoSnapImpl<CToolBoxFloatDlg>)
		CHAIN_MSG_MAP(AutoHideClass)

		REFLECT_NOTIFICATIONS_EX()
	END_MSG_MAP()		 


};

